    /********************************************************/
    /*                                                      */
    /*                                                      */
    /*         Copyright (C), 1993  SEIKO EPSON Corp.       */
    /*         ALL RIGHTS RESERVED                          */
    /*                                                      */
    /*                                                      */
    /*  file name : getc.c                                  */
    /*                                                      */
    /*  Revision history                                    */
    /*      93/12/17    first release       S.Akaiwa        */
    /*      97/3/17	modified	    T.Katahira	    */
    /*			change function declaration	    */
    /*					to the ANSI style   */
    /*                                                      */
    /********************************************************/

#ifdef  UNIX
#include    "stdio.h"
#include    "smcvals.h"
#else
#include    <stdio.h>
#include    <smcvals.h>
#endif

int
getc(FILE * fiStrmP)

    /********************************************************/
    /*                                                      */
    /*  The fgetc function reads a single character from    */
    /*  stream pointed to by fiStrmP.                       */
    /*  If stdin is not specified by fiStrmP, the getc      */
    /*  function returns EOF.                               */
    /*                                                      */
    /*      RETURN  Except EOF  ... The character read      */
    /*              EOF         ... Error                   */
    /*                                                      */
    /*  <ANSI>                                              */
    /*      The fgetc function reads a single character     */
    /*      from user specified stream.                     */
    /*                                                      */
    /*      RETURN  Except EOF  ... The character read      */
    /*              EOF         ... Error                   */
    /*                                                      */
    /********************************************************/

    /* FILE    *fiStrmP    ;       pointer to target stream */
    {
     
     unsigned char ucDat;

     if(fiStrmP != stdin){           /* stream except stdin */
        return  (int)EOF;                 /* illegal stream */
     }

     if(fiStrmP->_flg == _UGETY){  /* exist unget character */
        fiStrmP->_flg = _UGETN;    /* clear unget character */
        return  (int)fiStrmP->_buf;    /* return unget data */
     }

     else {                       /* read a data from stdin */
        if(read(fiStrmP->_fd, &ucDat, 1) < 1){
           return   (int)EOF;                 /* read error */
        }
        else {
            return  (int)ucDat;    /* return read character */
        }
     }
    }

